/*
* @Author: Administrator
* @Date:   2017-11-03 15:38:09
* @Last Modified by:   Administrator
* @Last Modified time: 2017-11-13 13:51:10
*/
 
 $(function(){

    $(".footer").load("layout/footer.html");
    $(".header2").load("layout/header2.html");

 var bannerHtml=$('#banner').html();
 var navHtml=$('#nav').html();
 var listHtml=$('#list').html();

  // 轮播图
    $(function() {
              $.ajax({
                       type:"get",
                       url:"http://localhost:8080/SST/u/lunbotu.do",
                       async:true,
                       success: function(data){
                        console.log(JSON.parse(data).banner);
                        var banner=JSON.parse(data).banner;
                        $('.banner').html(doT.template(bannerHtml)(banner));
                           
                            var swiper = new Swiper('.swiper-container', {
                                pagination: '.swiper-pagination',
                                nextButton: '.swiper-button-next',
                                prevButton: '.swiper-button-prev',
                                paginationClickable: true,
                                spaceBetween: 30,
                                centeredSlides: true,
                                autoplay: 2500,
                                autoplayDisableOnInteraction: false
                            });
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
                
    });

// 导航
$(function() {
              $.ajax({
                       type:"get",
                       url:"data/gongsihuonav.json",
                       async:true,
                       success: function(data){
                        console.log(data.gongsihuo);
                        var gongsihuodata=data.gongsihuo
                        $('.gongsihuo-nav').html(doT.template(navHtml)(gongsihuodata));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });
// list
$(function() {
              $.ajax({
                       type:"get",
                       url:"data/gongsihuolist.json",
                       async:true,
                       success: function(data){
                        console.log(data.list);
                        var listdata=data.list
                        $('.p-list-con').html(doT.template(listHtml)(listdata));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
             
       
    });
    
    
})
